﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sunboxsoft.WinForm;
using System.Diagnostics;
using Sunboxsoft.Common;
using Sunboxsoft.ASMS.Client.UI.Properties;
using System.Drawing;
using System.Threading;
using Service = Sunboxsoft.ASMS.Client.Domain.Service;
using WebRef = Sunboxsoft.ASMS.Client.Domain.WebRef;
using System.Windows.Forms;

namespace Sunboxsoft.ASMS.Client.UI
{
    public class Module : IModule, IStandalone
    {
        public static string LogTag = "ASMS.UI";
        #region IModule 成员

        public string Name
        {
            get
            {
                return "广东易捷汽车服务管理平台";
            }
        }

        public Image Image
        {
            get
            {
                return Resources.ilBus;
            }
        }

        public bool Authenticate()
        {
            string baseUrl = System.Configuration.ConfigurationManager.AppSettings["Sunboxsoft.ASMS.BaseUrl"];// "http://192.168.0.10:21671/";
            //string baseUrl = "http://localhost:1042/";
            Domain.RemoteInfo.BasesWebServiceURL = string.Format("{0}Services/BasesWebService.asmx", baseUrl);
            Domain.RemoteInfo.ASMSWebServiceURL = string.Format("{0}Services/ASMSWebService.asmx", baseUrl);

            return false;
        }

        public Form CreateAuthForm()
        {
            LoginForm loginForm = new LoginForm();
            Logger.InfoToTag(LogTag, "LoginForm.ShowDialog");
            return loginForm;
        }

        public bool Load(ModuleRuntimeContext context, ModuleLoadingProgress progress)
        {
            float total = 6.0f;
            float current = 0.0f;
            Logger.InfoToTag(LogTag, "Sunboxsoft.ASMS.Client.UI.Module.Register");

            progress(current++ / total, "获取店铺资料...");
            ListResult<WebRef.VStation> result = new Service.QueryService().QueryStationListByStaff(ModuleContext.Current.AccountId);
            if (result.IsSuccess && result.Data.Items.Count > 0)
            {
                ModuleContext.Current.StationArray = result.Data.Items.ToArray();
                WebRef.VStation station = result.Data.Items.FirstOrDefault();
                ModuleContext.Current.BusinessId = station.BusinessId;
                ModuleContext.Current.StationId = station.Id;
            }
            else
            {
                return false;
            }

            progress(current++ / total, "初始化本地数据库...");
            Thread.Sleep(500);
            // 初始化本地数据库
            if (new Domain.SQLiteDatabase(UIContext.Current.Config.StorageDirectory).Init() == false)
            {
                return false;
            }

            progress(current++ / total, "同步主数据...");
            ServiceResult syncResult = new Domain.MasterDataStorage().Sync();
            if (syncResult.IsSuccess == false)
            {
                MessageBox.Show(syncResult.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            progress(current++ / total, "同步业务数据...");
            Thread.Sleep(1000);

            progress(current++ / total, "注册功能项...");
            Thread.Sleep(500);

            WebRef.VStation currentStation = null;
            ActionNode swtichMenu = context.AddMenu(new ActionNode(NewActionName(), Resources.isSwitch, Resources.ilSwitch, "切换店铺", null));
            for (int index = 0; index < ModuleContext.Current.StationArray.Length; index++)
            {
                WebRef.VStation station = ModuleContext.Current.StationArray[index];
                ActionNode node = new ActionNode(NewActionName(), Resources.isStation, Resources.ilStation, station.Name, new Action<object, object>((o1, o2) =>
                {
                    UIContext.Current.ViewManager.ShowInfo(station.Name);
                }));
                swtichMenu.AddChild(node);
                if (ModuleContext.Current.StationId != null && station.Id == ModuleContext.Current.StationId.Value)
                {
                    currentStation = station;
                    node.Caption = string.Format("[已选择]{0}", node.Caption);
                    node.IsEnable = false;
                }
            }

            //context.AddMenu(new ActionNode(NewActionName(), Resources.isEdit, Resources.ilEdit, "注销", new Action<object, object>((o1, o2) =>
            //{
            //    UIContext.Current.ViewManager.ShowInfo("注销");
            //})));

            context.AddMenu(new ActionNode(NewActionName(), Resources.isExit, Resources.ilExit, "退出", new Action<object, object>((o1, o2) =>
            {
                UIContext.Current.ViewManager.Exit();
            })));

            #region status bar
            context.StatusBarLeftActions.AddAction(new TextEditActionNode(NewActionName(), "服务商") { Value = currentStation.BusinessName, Width = 120 });
            context.StatusBarLeftActions.AddAction(new TextEditActionNode(NewActionName(), "门店") { Value = currentStation.Name, Width = 120 });
            context.StatusBarLeftActions.AddAction(new TextEditActionNode(NewActionName(), "用户") { Value = ModuleContext.Current.UserName, Width = 120 });

            //context.StatusBarRightActions.AddAction(new TextEditActionNode(NewActionName(), "状态") { Value = "离线" });
            #endregion

            context.AddAction(new ActionNode("act10_0900", Resources.isBus, "日常事务/开单"))
                .AddChild(new ActionNode(null, "预约管理")
                    .AddChild(new CheckActionNode(FunctionCodes.BookingBillListView, Resources.isView, Resources.ilView, "预约服务列表", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Booking.BookingBillListView());
                    })))
                    .AddChild(new ActionNode("act100901", Resources.isBooking, Resources.ilBooking, "新建预约单", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ActiveActionNode(FunctionCodes.BookingBillListView);
                        UIContext.Current.ViewManager.PopupView(new Booking.SelectCustomerView(), new PopupViewArgs("新建预约单-选择客户"));
                    }))))
                .AddChild(new ActionNode(null, "开单流程")
                    .AddChild(new CheckActionNode(FunctionCodes.MaintenanceBillListView, Resources.isView, Resources.ilView, "服务单列表", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Dispatching.MaintenanceBillListView());
                    })))
                    .AddChild(new ActionNode("act100903", Resources.isDispatchingBookList, Resources.ilDispatchingBookList, "接待开单", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ActiveActionNode(FunctionCodes.MaintenanceBillListView);
                        UIContext.Current.ViewManager.PopupView(new Create.CreateMaintenanceBillView(), new PopupViewArgs("接待开单"));
                    })))
                    .AddChild(new CheckActionNode("act100904", Resources.isDispatchingOrderList, Resources.ilDispatchingOrderList, "派工施工", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Dispatching.WaitDispatchingBillListView());
                    })))
                    .AddChild(new CheckActionNode("act100905", Resources.isGetMaterial, Resources.ilGetMaterial, "领料退料", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Dispatching.WaitMaterialRequisitionBillListView());
                    })))
                    .AddChild(new CheckActionNode("act100906", Resources.isSettling, Resources.ilSettling, "结算收银", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Settling.WaitSettmentBillListView());
                    })))
                    .AddChild(new CheckActionNode("act100907", Resources.isBus, Resources.ilBus, "等待出厂", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Settling.WaitCarOutListView());
                    }))))
                .AddChild(new ActionNode(null, "充值")
                    .AddChild(new ActionNode("act1009081", Resources.isRecharge, Resources.ilRecharge, "账户充值", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ActiveActionNode(FunctionCodes.RechargeBillListView);
                        UIContext.Current.ViewManager.PopupView(new Create.CreateRechargeBillView(), new PopupViewArgs("客户充值"));
                    })))
                    .AddChild(new CheckActionNode(FunctionCodes.RechargeBillListView, Resources.isRechargeList, Resources.ilRechargeList, "账户充值列表", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Recharge.RechargeBillListView());
                    }))))
                .AddChild(new ActionNode(null, "购买套餐")
                    .AddChild(new ActionNode("act10090B", Resources.isPackage, Resources.ilPackage, "购买套餐", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ActiveActionNode(FunctionCodes.PackagePurchaseBillListView);
                        UIContext.Current.ViewManager.PopupView(new Create.CreatePackagePurchaseBillView(), new PopupViewArgs("购买套餐"));
                    })))
                    .AddChild(new CheckActionNode(FunctionCodes.PackagePurchaseBillListView, Resources.isPackageList, Resources.ilPackageList, "购买套餐列表", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Package.PackagePurchaseBillListView());
                    }))));
            context.AddAction(new ActionNode("act10_0800", Resources.isStock, "商品/库存"))
                .AddChild(new ActionNode(null, "服务单物料管理")
                    .AddChild(new CheckActionNode("act100801", Resources.isGetMaterial, Resources.ilGetMaterial, "领料退料", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Dispatching.WaitMaterialRequisitionBillListView());
                    }))))
                .AddChild(new ActionNode(null, "库存管理")
                    .AddChild(new CheckActionNode("act1008001", Resources.isStock, Resources.ilStock, "库房管理", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Storage.WarehouseListView());
                    })))
                    .AddChild(new CheckActionNode(FunctionCodes.LocalStorageView, Resources.isStockList, Resources.ilStockList, "库存查询", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Storage.LocalStorageView());
                    })))
                    .AddChild(new CheckActionNode("act100801", Resources.isStockChangedList, Resources.ilStockChangedList, "出入库记录", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Storage.StockChangedRecordListView());
                    })))
                    .AddChild(new CheckActionNode("act100801", Resources.isStockWarning, Resources.ilStockWarning, "库存预警", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new StockWarning.StockWarningListView());
                    }))))
                .AddChild(new ActionNode(NewActionName(), "入库管理")
                    .AddChild(new ActionNode(NewActionName(), Resources.isMaterial, Resources.ilMaterial, "采购入库", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ActiveActionNode(FunctionCodes.LocalStorageView);
                        UIContext.Current.ViewManager.PopupView(new Create.CreatePurchaseStockIncreaseBillView(), new PopupViewArgs("创建采购入库单"));
                    })))
                    .AddChild(new ActionNode(NewActionName(), Resources.isOtherIncrease, Resources.ilOtherIncrease, "其他方式入库", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ActiveActionNode(FunctionCodes.LocalStorageView);
                        UIContext.Current.ViewManager.PopupView(new Create.CreateOtherStockIncreaseBillView(), new PopupViewArgs("创建其他入库单"));
                    }))))
                .AddChild(new ActionNode(NewActionName(), "出库管理")
                    .AddChild(new ActionNode(NewActionName(), Resources.isOtherDecrease, Resources.ilOtherDecrease, "其他方式出库", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ActiveActionNode(FunctionCodes.LocalStorageView);
                        UIContext.Current.ViewManager.PopupView(new Create.CreateOtherStockDecreaseBillView(), new PopupViewArgs("创建其他出库单"));
                    }))));
            context.AddAction(new ActionNode(NewActionName(), Resources.isBus, "财务/收银"))
                .AddChild(new ActionNode(NewActionName(), "订单收银")
                    .AddChild(new CheckActionNode(NewActionName(), Resources.isSettling, Resources.ilSettling, "服务单结算收银", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Settling.WaitSettmentBillListView());
                    })))
                    .AddChild(new CheckActionNode(NewActionName(), Resources.ilPackageList, Resources.ilPackageList, "套餐结算收银", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Package.PackagePurchaseBillListView("CheckedOut"));
                    })))
                    .AddChild(new CheckActionNode(NewActionName(), Resources.isRechargeList, Resources.ilRechargeList, "充值收银", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Recharge.RechargeBillListView("CheckedOut"));
                    }))))
                .AddChild(new ActionNode(NewActionName(), "资金管理")
                      .AddChild(new CheckActionNode(NewActionName(), Resources.isCapitalRecordList, Resources.ilCapitalRecordList, "资金流水明细", new Action<object, object>((o1, o2) =>
                      {
                          UIContext.Current.ViewManager.ReplaceRootView(new Capital.CapitalChangeListView());
                      })))
                    .AddChild(new CheckActionNode(NewActionName(), Resources.isCapitalIncreaseList, Resources.ilCapitalIncreaseList, "资金入账", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Capital.CapitalIncreaseBillListView());
                        UIContext.Current.ViewManager.PopupView(new Create.CreateCapitalIncreaseView(), new PopupViewArgs("资金入账"));
                    })))
                    .AddChild(new CheckActionNode(NewActionName(), Resources.isCapitalDecreaseList, Resources.ilCapitalDecreaseList, "资金出帐", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Capital.CapitalDecreaseBillListView());
                        UIContext.Current.ViewManager.PopupView(new Create.CreateCapitalDecreaseView(), new PopupViewArgs("资金出帐"));
                    }))));
            context.AddAction(new ActionNode(NewActionName(), Resources.isMoney, "客户/营销"))
                .AddChild(new ActionNode(NewActionName(), "客户资料")
                    .AddChild(new CheckActionNode(NewActionName(), Resources.isCustomer, Resources.ilCustomer, "客户管理", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Management.CustomerListView());
                    })))
                    .AddChild(new CheckActionNode(NewActionName(), Resources.isAutomobile, Resources.ilAutomobile, "车辆管理", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Management.AutomobileListView());
                    }))))
                .AddChild(new ActionNode(NewActionName(), "套餐管理")
                    .AddChild(new ActionNode(NewActionName(), Resources.isBooking, Resources.ilPackage, "购买套餐", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ActiveActionNode(FunctionCodes.PackagePurchaseBillListView);
                        UIContext.Current.ViewManager.PopupView(new Create.CreatePackagePurchaseBillView(), new PopupViewArgs("购买套餐"));
                    })))
                    .AddChild(new CheckActionNode(NewActionName(), Resources.isPackageChangedList, Resources.ilPackageChangedList, "套餐使用情况", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ViewManager.ReplaceRootView(new Package.PackageUseRecordListView());
                    }))))
                .AddChild(new ActionNode(NewActionName(), "充值管理")
                    .AddChild(new ActionNode(NewActionName(), Resources.isRecharge, Resources.ilRecharge, "账户充值", new Action<object, object>((o1, o2) =>
                    {
                        UIContext.Current.ActiveActionNode(FunctionCodes.RechargeBillListView);
                        UIContext.Current.ViewManager.PopupView(new Create.CreateRechargeBillView(), new PopupViewArgs("账户充值"));
                    }))));
            //context.AddAction(new ActionNode(NewActionName(), Resources.isBus, "日结/盘点"))
            //    .AddChild(new ActionNode(NewActionName(), "日结/盘点")
            //        .AddChild(new ActionNode(NewActionName(), Resources.isBooking, Resources.ilBooking, "日结管理", null))
            //        .AddChild(new ActionNode(NewActionName(), Resources.isBooking, Resources.ilBooking, "盘点管理", null)));
            //context.AddAction(new ActionNode(NewActionName(), Resources.isBus, Resources.ilBooking, "报表/统计", null))
            //    .AddChild(new ActionNode(NewActionName(), "报表/统计")
            //        .AddChild(new ActionNode(NewActionName(), Resources.isBooking, Resources.ilBooking, "报表", null))
            //        .AddChild(new ActionNode(NewActionName(), Resources.isBooking, Resources.ilBooking, "统计分析", null)));
            /*
            context.RegisterAction(new ActionNode("act10_1000", Resources.isBus, "汽服模块"))
                .AddChild(new ActionNode("act10_1001", "日常事务/开单")
                    .AddChild(new CheckActionNode("act10_1002", Resources.isBooking, Resources.ilBooking, "预约", onBookingItemClick)))
                //.AddChild(new CheckActionNode("act10_1003", Resources.isCreateCustomer, Resources.ilCreateCustomer, "新建客户", onCreateCustomerItemClick)))
                .AddChild(new ActionNode("act10_1004", Resources.isDispatchingBookList, "派工管理")
                    .AddChild(new CheckActionNode("act10_1005_1", Resources.isDispatchingBookList, Resources.ilDispatchingBookList, "服务单列表", onDispatchingBookListItemClick))
                    .AddChild(new CheckActionNode("act10_1005", Resources.isDispatchingBookList, Resources.ilDispatchingBookList, "接车派工", OnCreateOrderActionClick))
                    .AddChild(new CheckActionNode("act10_1006", Resources.isDispatchingOrderList, Resources.ilDispatchingOrderList, "派工施工", onDispatchingOrderListItemClick))
                    .AddChild(new CheckActionNode("act10_1007", Resources.isGetMaterial, Resources.ilGetMaterial, "领料退料", null)))
                .AddChild(new ActionNode("act10_1008", Resources.isSettings, "账单管理")
                    .AddChild(new CheckActionNode("act10_1009", Resources.isSettling, Resources.ilSettling, "结算收银", onSettlingItemClick))
                    .AddChild(new CheckActionNode("act10_1010", Resources.isBus, Resources.ilBus, "车辆出厂", OnCarOutItemClick)))
                .AddChild(new ActionNode("act10_1011", Resources.isSettings, "充值管理")
                    .AddChild(new CheckActionNode("act10_1012", Resources.isRechargeList, Resources.ilRechargeList, "充值列表", onRechargeItemClick)))
                //.AddChild(new CheckActionNode("act10_1013", Resources.isRecharge, Resources.ilRecharge, "账户充值", onAccountRechargeClick)))
                .AddChild(new ActionNode("act10_1014", Resources.isSettings, "套餐管理")
                //.AddChild(new CheckActionNode("act10_1015", Resources.isPackageList, Resources.ilPackageList, "套餐列表", onPackageItemClick))
                    .AddChild(new CheckActionNode("act10_1016", Resources.isPackage, Resources.ilPackage, "购买套餐", OnPackagePurchaseListClick)))
                .AddChild(new ActionNode("act10_1014", Resources.isSettings, "库存管理")
                //.AddChild(new CheckActionNode("act10_10141", Resources.isPackageList, Resources.ilPackageList, "仓库列表", OnWarehouseListActionClick))
                    .AddChild(new CheckActionNode("act10_10143", Resources.isPackageList, Resources.ilPackageList, "库存情况", OnLocalStorageActionClick)
                        .AddChild(new ActionNode("act10_101430", Resources.isPackageList, Resources.ilPackageList, "测试页面", new Action<object, object>((o1, o2) =>
                        {
                            UIContext.Current.ViewManager.ReplaceRootView(new Storage.StockChangedRecordListView());
                        })))
                        .AddChild(new ActionNode("act10_101431", Resources.isPackageList, Resources.ilPackageList, "采购入库", OnCreateSupplyStockIncreaseBillClick))
                        .AddChild(new ActionNode("act10_101431", Resources.isPackageList, Resources.ilPackageList, "其他入库", OnCreateOtherStockIncreaseBillClick))
                        .AddChild(new ActionNode("act10_101432", Resources.isPackageList, Resources.ilPackageList, "其他出库", null))));
            //.AddChild(new CheckActionNode("act10_10143", Resources.isPackageList, Resources.ilPackageList, "商品列表", OnMaterialListActionClick))
            //.AddChild(new CheckActionNode("act10_10144", Resources.isPackageList, Resources.ilPackageList, "供应商列表", OnSupplierListActionClick)))
            //.AddChild(new ActionNode("act10_1017", Resources.isSettings, "基础数据管理")
            //    .AddChild(new CheckActionNode("act10_10171", Resources.isSettings, Resources.ilSettings, "充值项目列表", new Action<object, object>((o1,o2)=>{
            //        UIContext.Current.ViewManager.ReplaceRootView(new Recharge.RechargeItemListView());
            //    })))
            //    .AddChild(new CheckActionNode("act10_1018", Resources.isSettings, Resources.ilSettings, "付费项目列表", OnPayItemListActionClick))
            //    .AddChild(new CheckActionNode("act10_1019", Resources.isSettings, Resources.ilSettings, "服务类别列表", OnServiceCategoryListClick))
            //    .AddChild(new CheckActionNode("act10_101A", Resources.isSettings, Resources.ilSettings, "服务项目列表", OnServiceItemListClick)));

            context.RegisterAction(new ActionNode("act10_1100", Resources.isBus, "主数据管理"))
                .AddChild(new ActionNode("act10_1101", "商家管理")
                    .AddChild(new CheckActionNode("act10_1102", Resources.isBooking, Resources.ilBooking, "商家列表", null))
                    .AddChild(new CheckActionNode("act10_1103", Resources.isCreateCustomer, Resources.ilCreateCustomer, "店铺列表", null)));
            */

            context.SetDefaultAction(FunctionCodes.BookingBillListView);

            progress(current++ / total, "加载完毕...");
            Thread.Sleep(1000);
            return true;
        }

        public void Release()
        {

        }

        #endregion

        #region IStandalone

        public bool Run()
        {
            if (new LaunchForm(this).ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return false;
            }
            return true;
        }
        #endregion

        int _actionSeed = 1000;
        private string NewActionName()
        {
            return string.Format("act10{0}", _actionSeed++);
        }

        public void onBookingItemClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Booking.BookingBillListView());
        }

        public void onCreateCustomerItemClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Create.CreateCustomerView());
        }

        public void OnCreateOrderActionClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Create.CreateMaintenanceBillView());
        }

        public void onDispatchingBookListItemClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Dispatching.MaintenanceBillListView());
        }

        public void onDispatchingOrderListItemClick(object obj1, object obj2)
        {
            //UIContext.Current.ViewManager.ReplaceRootView(new Dispatching());
        }

        public void onSettlingItemClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Settling.WaitSettmentBillListView());
        }

        //车辆出厂
        public void OnCarOutItemClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Settling.WaitCarOutListView());
        }
        //充值列表
        public void onRechargeItemClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Recharge.RechargeBillListView());
        }
        //账户充值
        public void onAccountRechargeClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Create.CreateRechargeBillView());
        }
        public void OnPackagePurchaseListClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Package.PackagePurchaseBillListView());
        }

        public void OnServiceCategoryListClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Management.ServiceCategoryListView());
        }

        public void OnServiceItemListClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Management.ServiceItemListView());
        }

        public void OnPayItemListActionClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Management.PayItemListView());
        }

        public void OnLocalStorageActionClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Storage.LocalStorageView());
        }


        public void OnMaterialListActionClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Material.MaterialListView());
        }

        public void OnWarehouseListActionClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Storage.WarehouseListView());
        }

        public void OnSupplierListActionClick(object obj1, object obj2)
        {
            UIContext.Current.ViewManager.ReplaceRootView(new Storage.SupplierListView());
        }
    }
}
